<template>
  <div class="input">
    <input type="text" placeholder="请输入名称" @input="searchMoun($event)" />
    <img class="sub_img" src="~assets/img/sub.png" alt />
    <ul class="change_list" v-if="isShowSelect">
      <li
        v-for="item in mountainList"
        :key="item.id"
        class="change_item"
        @click="$emit('viewdetails', item)"
      >{{item.mountain_name}}</li>
      <li v-show="mountainList.length == 0" class="change_item">暂无更多数据</li>
    </ul>
  </div>
</template>

<script>
import { searchMountain } from "api/positioning";
export default {
  name: "Input",
  props: ["searchKeyword", "mountainList", "isShowSelect"],
  methods: {
    searchMoun(e) {
      this.$emit("changeKey", e.target.value);
    } 
  },
  mounted() {},
};
</script>

<style lang="less" scoped>
.input {
  position: absolute;
  top: 20px;
  left: 10px;
  z-index: 10;
  height: 40px;
  input {
    margin: 0 auto;
    padding-left: 10px;
    padding-right: 60px;
    height: 100%;
    border-radius: 5px;
    border: 1px solid #eee;
  }
  .sub_img {
    position: relative;
    right: 40px;
    width: 30px;
    height: 30px;
  }
  .change_list {
    padding: 10px;
    width: 178px;
    background: #fff;
    .change_item {
      height: 30px;
      line-height: 30px;
    }
  }
}
</style>